package com.doublefish.doublefishrobot.ui.setting;

import android.widget.CompoundButton;
import android.widget.TextView;

import androidx.appcompat.widget.SwitchCompat;

import com.doublefish.doublefishrobot.R;
import com.doublefish.doublefishrobot.base.BaseActivity;
import com.doublefish.doublefishrobot.utils.AppCacheUtil;

import butterknife.BindView;
import butterknife.OnClick;

public class SafeAlertSettingActivity extends BaseActivity {

    @BindView(R.id.tv_title)
    TextView titleTv;

    @BindView(R.id.switch_compat)
    SwitchCompat switchCompat;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_safe_alert_setting;
    }

    @Override
    protected void initView() {
        titleTv.setText(R.string.speed_warning);
        switchCompat.setChecked(!AppCacheUtil.getInstance().isIgnoreSpeedTips());
    }

    @Override
    protected void initData() {
    }

    @Override
    protected void initListener() {
        switchCompat.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
                AppCacheUtil.getInstance().setIgnoreSpeedTips(!b);
            }
        });
    }

    @OnClick(R.id.ll_back)
    public void onBackBtnClick() {
        finish();
    }

}
